package com.js.myapp.system.timer;

// Created by JS on 2021/1/20.

import android.os.CountDownTimer;
import android.widget.TextView;

public class SplashCountDownTimer extends CountDownTimer {

    private TextView mTextView;

    /**
     *
     * @param millisInFuture 总的倒计时毫秒数
     * @param countDownInterval 倒计时间隔
     * @param textView 显示时间的TextView控件
     */
    public SplashCountDownTimer(long millisInFuture, long countDownInterval, TextView textView) {
        super(millisInFuture, countDownInterval);
        this.mTextView = textView;
    }

    @Override
    public void onTick(long millisUntilFinished) {
        mTextView.setText(millisUntilFinished / 1000 + "s");
    }

    @Override
    public void onFinish() {
        mTextView.setText("0s");
    }
}
